package com.cy.ppj.dao.mapper.order;

import java.util.List;

import com.cy.ppj.model.dto.order.OrderDealRecordDTO;
import com.cy.ppj.model.dto.order.ToDayLoanSuccessOrderCountDTO;
import com.cy.ppj.model.dto.statistics.OrderLoanRateStatisticsDTO;
import com.cy.ppj.model.enums.OrderWithholdStatus;
import com.cy.ppj.model.enums.Process;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.cy.ppj.model.domian.order.Order;
import com.cy.ppj.model.query.OrderAdminByTypeQuery;
import com.cy.ppj.model.query.OrderAdminQuery;
import com.cy.ppj.model.query.OrderQuery;
import com.cy.ppj.model.query.order.DecorationPassOrderListAdminQuery;
import com.cy.ppj.model.query.order.OrderCountQuery;
import com.cy.ppj.model.query.order.OrderScanRecordAdminQuery;
import com.cy.ppj.model.query.order.OrderScanRecordQuery;
import com.cy.ppj.model.query.statistics.OrderGroupByCityStatisticsQuery;
import com.cy.ppj.model.vo.OrderAdminByTypeVO;
import com.cy.ppj.model.vo.OrderAdminVO;
import com.cy.ppj.model.vo.OrderDetailAdminVO;
import com.cy.ppj.model.vo.OrderDetailVO;
import com.cy.ppj.model.vo.OrderProcessVO;
import com.cy.ppj.model.vo.OrderScanRecordDetailVO;
import com.cy.ppj.model.vo.OrderVO;
import com.cy.ppj.model.vo.admin.order.DecorationPassOrderListAdminVO;
import com.cy.ppj.model.vo.admin.order.OrderScanRecordAdminVO;
import com.cy.ppj.model.vo.admin.order.OrderScanRecordVO;
import com.cy.ppj.model.vo.admin.statistics.OrderGroupByCityStatisticsVO;
import com.cy.ppj.model.vo.admin.statistics.OrderLoanRateStatisticsVO;
import com.cy.ppj.model.vo.order.FurnitureGoodsOrderDetailAdminVO;

import tk.mybatis.mapper.common.BaseMapper;

/**
 * @description: 订单
 * @author: tanyilin
 * @create: 2018年7月20日 下午8:09:08
 */
@Mapper
public interface OrderMapper extends BaseMapper<Order>{

	int queryOrderListCount(OrderQuery orderQuery);
	
	List<OrderVO> queryOrderList(OrderQuery orderQuery); 
	
	OrderDetailVO queryOrderDetail(@Param("orderId") Long orderId);
	
	List<OrderProcessVO> queryOrderProcess(@Param("orderId") Long orderId, @Param("processes") List<Process> processes);
	
	int queryOrderAdminListCount(OrderAdminQuery orderAdminQuery);
	
	List<OrderAdminVO> queryOrderAdminList(OrderAdminQuery orderAdminQuery); 
	
	int queryOrderAdminByTypeCount(OrderAdminByTypeQuery query);
	
	List<OrderAdminByTypeVO> queryOrderAdminByType(OrderAdminByTypeQuery query);

	int updateCommissionStatusComplete(Long orderId);
	
	/**
	 * 订单代扣状态更改
	 * @param orderId
	 * @param withholdStatus
	 * @return
	 */
	int updateWithholdStatus(@Param("orderId") Long orderId, @Param("withholdStatus") OrderWithholdStatus withholdStatus);

	int selectOrderScanRecordAdminCount(OrderScanRecordAdminQuery query);

	List<OrderScanRecordAdminVO> selectOrderScanRecordAdminList(OrderScanRecordAdminQuery query);

	int selectOrderScanRecordCount(OrderScanRecordQuery query);

	List<OrderScanRecordVO> selectOrderScanRecordList(OrderScanRecordQuery query);

	OrderDealRecordDTO selectOrderDealRecordInfo(@Param("orderId") Long orderId);

	OrderDealRecordDTO selectOrderDealRecordInfo2(@Param("orderId") Long orderId);
	
	/**
	 * 订单浏览记录信息
	 * 
	 * @param orderId
	 * @return
	 */
	OrderScanRecordDetailVO selectOrderScanRecordDetail(@Param("orderId") Long orderId);
	
	int selectAllOrderAdminListCount(OrderAdminQuery query);
	
	List<OrderAdminVO> selectAllOrderAdminList(OrderAdminQuery query);

	int selectUnassignedOrderAdminListCount(OrderAdminQuery query);

	List<OrderAdminVO> selectUnassignedOrderAdminList(OrderAdminQuery query);

	int selectProcessingOrderAdminListCount(OrderAdminQuery query);

	List<OrderAdminVO> selectProcessingOrderAdminList(OrderAdminQuery query);

	int selectPassOrderAdminListCount(OrderAdminQuery query);

	List<OrderAdminVO> selectPassOrderAdminList(OrderAdminQuery query);

	int selectRejectOrderAdminListCount(OrderAdminQuery query);

	List<OrderAdminVO> selectRejectOrderAdminList(OrderAdminQuery query);
	
	/**
	 * 查询今日交单数
	 * 
	 * @return
	 */
	int selectToDayApplyOrderCount(OrderCountQuery query);
	
	/**
	 * 查询今日批款单数
	 * 
	 * @return
	 */
	ToDayLoanSuccessOrderCountDTO selectToDayLoanSuccessOrderCount(OrderCountQuery query);
	
	/**
	 * 查询今日拒绝单数
	 * 
	 * @return
	 */
	int selectToDayRejectOrderCount(OrderCountQuery query);
	
	/**
	 * 放款率统计
	 * 
	 * @return
	 */
	OrderLoanRateStatisticsDTO selectOrderLoanRateStatisticsDTO();
	
	/**
	 * 订单'放款量'按城市分组统计
	 * 
	 * @param query
	 * @return
	 */
	List<OrderGroupByCityStatisticsVO> selectOrderLoanAmountGroupByCityStatisticsVOs(OrderGroupByCityStatisticsQuery query);
	
	/**
	 * 订单'提单量'按城市分组统计
	 * 
	 * @param query
	 * @return
	 */
	List<OrderGroupByCityStatisticsVO> selectOrderCountGroupByCityStatisticsVOs(OrderGroupByCityStatisticsQuery query);

	int selectDecorationPassOrderListAdminCount(DecorationPassOrderListAdminQuery query);
	
	List<DecorationPassOrderListAdminVO> selectDecorationPassOrderListAdmin(DecorationPassOrderListAdminQuery query);

	/**
	 * 查询后台订单详情
	 * 
	 * @param orderId
	 * @return
	 */
	OrderDetailAdminVO selectOrderDetailAdminVO(Long orderId);

	/**
	 * 查询后台-家具分期商品订单详情
	 * 
	 * @param orderId
	 * @return
	 */
	FurnitureGoodsOrderDetailAdminVO selectFurnitureGoodsOrderDetailAdminVO(Long orderId);
	
	
}
